﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pay_My_Server.DB;
using Pay_My_Server.Connector;
using Pay_My_Server.Implements;

namespace Pay_My_Server.Remote
{
    public class RemoteClass : IRemote
    {
        private ADOConnector adapter;


        public RemoteClass()
        {
            // on créer le connecteur et hop on se connecte
            this.Adapter = new ADOConnector();
            this.Adapter.Connect();
        }

        public void Dispose()
        {
            // on se déconnecte pour pas garder de connexion ouverte.
            this.Adapter.Disconnect();
        }

        public ADOConnector Adapter { get { return this.adapter; } set { this.adapter = value; } }

        public List<Entity.Product.ICatalog> getAllCatalogs()
        {
            throw new NotImplementedException();
        }

        /*
         * Exemple de remplissage de données.
         * 
         */ 
        public List<Entity.Product.ICategory> getAllCategories()
        {
            // exemple : on prend tout ce qui a dans les Types de Produits et on les fous dedans. 
            List<Entity.Product.ICategory> list = new List<Entity.Product.ICategory>();
            foreach (Type_Produit type in this.Adapter.DataContext.Type_Produit.ToList())
            {
                // ProdCategory implements the ICategory interface
               list.Add(new ProdCategory(type.id_type_prod, type.nom_type_prod));
            }
            return list;
        }

        public List<Entity.Product.ICatalog> getAllMenu()
        {
            throw new NotImplementedException();
        }

        public List<Entity.Product.IProduct> getAllProducts()
        {
            throw new NotImplementedException();
        }

        public List<Entity.IUser> getAllUsers()
        {
            throw new NotImplementedException();
        }

        public List<Entity.IUser> getUsersByStat(bool? member, bool? admin)
        {
            throw new NotImplementedException();
        }

        public Entity.Product.IProduct GetProductByCode(string code)
        {
            throw new NotImplementedException();
        }


        public Entity.IUser getUserByCode(string code)
        {
            throw new NotImplementedException();
        }

        public Entity.Product.ICatalog addCatalog(Entity.Product.ICatalog catalog)
        {
            throw new NotImplementedException();
        }

        public Entity.Product.ICategory addCategory(Entity.Product.ICategory category)
        {
            throw new NotImplementedException();
        }

        public Entity.Product.IMenu addMenu(Entity.Product.IMenu category)
        {
            throw new NotImplementedException();
        }

        public Entity.Product.IProduct addProduct(Entity.Product.IProduct product)
        {
            throw new NotImplementedException();
        }

        public Entity.IUser addUser(Entity.IUser user)
        {
            throw new NotImplementedException();
        }

        public void removeCatalog(Entity.Product.ICatalog catalog)
        {
            throw new NotImplementedException();
        }

        public void removeCategory(Entity.Product.ICategory category)
        {
            throw new NotImplementedException();
        }

        public void removeMenu(Entity.Product.IMenu menu)
        {
            throw new NotImplementedException();
        }

        public void removeProduct(Entity.Product.IProduct product)
        {
            throw new NotImplementedException();
        }

        public void removeUser(Entity.IUser user)
        {
            throw new NotImplementedException();
        }

        public void sendStockChange(Entity.Movement.IStock mouvementStock)
        {
            throw new NotImplementedException();
        }

        public void sendFundsChange(Entity.Movement.IFunds mouvementFonds)
        {
            throw new NotImplementedException();
        }

        public void sendSaleTransaction(Entity.Movement.ISale vente)
        {
            throw new NotImplementedException();
        }

        public double Funds
        {
            get { throw new NotImplementedException(); }
        }
    }
}
